<?php

class Form extends Controller {
	
	function index()
	{
		$this->load->helper(array('form', 'url'));
		
		//$this->output->enable_profiler(TRUE);
		
		$this->load->library('form_validation');
		
		$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]');
		$this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]');
		$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
		$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
				
		if ($this->form_validation->run() == FALSE)
		{
			$this->load->view('myform');
		}
		else
		{
			$this->load->view('formsuccess');
		}
		
		$this->load->library('pagination');

		$config['base_url'] = 'http://localhost/CodeIgniter_1.7.2/form/page/';
		$config['total_rows'] = '200';
		$config['per_page'] = '20';
		
		$this->pagination->initialize($config);
		
		echo $this->pagination->create_links();
				
	}
	
	function page($number=1) {
		
		echo $number.'<br />';
		$this->load->library('pagination');

	$config['base_url'] =  'http://localhost/CodeIgniter_1.7.2/form/page/';
	$config['total_rows'] = '200';
	$config['per_page'] = '30';
	
	$this->pagination->initialize($config);
	
	echo $this->pagination->create_links();
		
	}
}
?>